import { Navigate, Outlet } from "umi";

const useAuth = () => {
  return localStorage.getItem("token");
};

export default () => {
  const isLogin = useAuth();
  if (isLogin) {
    return <Outlet />;
  } else {
    return <Navigate to="/login" />;
  }
};
